<template>
  <div>
      <el-form :inline="true" v-show="isSearchCollapse" class="query-form" ref="searchForm" :model="searchForm" @keyup.enter.native="refreshList()" @submit.native.prevent>
            <!-- 搜索框-->
         <el-form-item prop="publisher.id">
            <GridSelect
                    title="选择发布人ID"
                    labelName = 'phone'
                    labelValue = 'id'
                    :value = "searchForm.publisher.id"
                    :limit="1"
                    size="small"
                    @getValue='(value) => {searchForm.publisher.id=value}'
                    :columns="[
                    {
                      prop: 'id',
                      label: '主键'
                    },
                    {
                      prop: 'phone',
                      label: '手机号(账号唯一)'
                    },
                    {
                      prop: 'nikeName',
                      label: '昵称'
                    }
                    ]"
                    :searchs="[
                    {
                      prop: 'phone',
                      label: '手机号(账号唯一)'
                    },
                    {
                      prop: 'nikeName',
                      label: '昵称'
                    }
                    ]"
                    dataListUrl="/userinfo/tUserInfo/list"
                    entityBeanName="tUserInfo"
                    queryEntityUrl="/userinfo/tUserInfo/queryById">
                  </GridSelect>
         </el-form-item>
         <el-form-item prop="certification.id">
            <GridSelect
                    title="选择信息认证ID"
                    labelName = 'enterpriseFullName'
                    labelValue = 'id'
                    :value = "searchForm.certification.id"
                    :limit="1"
                    size="small"
                    @getValue='(value) => {searchForm.certification.id=value}'
                    :columns="[
                    {
                      prop: 'id',
                      label: '主键'
                    },
                    {
                      prop: 'enterpriseFullName',
                      label: '企业全称'
                    },
                    {
                      prop: 'unifiedSocialCreditCode',
                      label: '统一社会信用代码'
                    },
                    {
                      prop: 'companySize',
                      label: '公司规模'
                    },
                    {
                      prop: 'legalPersonName',
                      label: '法人姓名'
                    },
                    {
                      prop: 'attentionLine',
                      label: '经办人姓名'
                    },
                    {
                      prop: 'operatorsTelephone',
                      label: '经办人电话'
                    },
                    {
                      prop: 'affiliationIndustry',
                      label: '所属行业'
                    }
                    ]"
                    :searchs="[
                    {
                      prop: 'enterpriseFullName',
                      label: '企业全称'
                    },
                    {
                      prop: 'unifiedSocialCreditCode',
                      label: '统一社会信用代码'
                    },
                    {
                      prop: 'legalPersonName',
                      label: '法人姓名'
                    },
                    {
                      prop: 'attentionLine',
                      label: '经办人姓名'
                    },
                    {
                      prop: 'operatorsTelephone',
                      label: '经办人电话'
                    },
                    {
                      prop: 'affiliationIndustry',
                      label: '所属行业'
                    }
                    ]"
                    dataListUrl="/p_enterprisecertification/pEnterpriseCertification/list"
                    entityBeanName="pEnterpriseCertification"
                    queryEntityUrl="/p_enterprisecertification/pEnterpriseCertification/queryById">
                  </GridSelect>
         </el-form-item>
         <el-form-item prop="bussinessType">
                  <el-radio-group v-model="searchForm.bussinessType">
                    <el-radio v-for="item in $dictUtils.getDictList('business_type')" :label="item.value" :key="item.id">{{item.label}}</el-radio>
                  </el-radio-group>
         </el-form-item>
         <el-form-item prop="recruitmentType">
          <el-select
          v-model="searchForm.recruitmentType"
          placeholder="招聘类型"
          size="small"
          style="width: 100%"
        >
          <el-option label="待审核" value="1">全职</el-option>
          <el-option label="已审核" value="2">兼职</el-option>
        </el-select>
         </el-form-item>
         <el-form-item prop="title">
                <el-input size="small" v-model="searchForm.title" placeholder="标题" clearable></el-input>
         </el-form-item>
         <!-- <el-form-item prop="positionName">
                <el-input size="small" v-model="searchForm.positionName" placeholder="职位名称" clearable></el-input>
         </el-form-item>
         <el-form-item prop="yearsService">
                <el-input size="small" v-model="searchForm.yearsService" placeholder="工作年限" clearable></el-input>
         </el-form-item>
         <el-form-item prop="educationalRequirements">
                <el-input size="small" v-model="searchForm.educationalRequirements" placeholder="学历要求" clearable></el-input>
         </el-form-item>
         <el-form-item prop="salaryRange">
                <el-input size="small" v-model="searchForm.salaryRange" placeholder="薪资范围" clearable></el-input>
         </el-form-item>
         <el-form-item prop="fringeBenefits">
                <el-input size="small" v-model="searchForm.fringeBenefits" placeholder="福利待遇" clearable></el-input>
         </el-form-item>
         <el-form-item prop="companyProfile">
                <el-input size="small" v-model="searchForm.companyProfile" placeholder="公司简介" clearable></el-input>
         </el-form-item>
         <el-form-item prop="settlementMethod">
                <el-input size="small" v-model="searchForm.settlementMethod" placeholder="结算方式" clearable></el-input>
         </el-form-item>
         <el-form-item prop="workCycle">
                <el-input size="small" v-model="searchForm.workCycle" placeholder="工作周期" clearable></el-input>
         </el-form-item>
         <el-form-item prop="positionCategory">
                <el-input size="small" v-model="searchForm.positionCategory" placeholder="职位类别" clearable></el-input>
         </el-form-item> -->
         <el-form-item prop="region">
                <el-input size="small" v-model="searchForm.region" placeholder="所在区域" clearable></el-input>
         </el-form-item>
         <!-- <el-form-item prop="workLocation">
                <el-input size="small" v-model="searchForm.workLocation" placeholder="工作地点" clearable></el-input>
         </el-form-item> -->
         <el-form-item prop="contactNumber">
                <el-input size="small" v-model="searchForm.contactNumber" placeholder="联系电话" clearable></el-input>
         </el-form-item>
         <!-- <el-form-item prop="recruitersNumber">
                <el-input size="small" v-model="searchForm.recruitersNumber" placeholder="招聘人数" clearable></el-input>
         </el-form-item> -->
         <!-- <el-form-item prop="genderRequirements">
                  <el-radio-group v-model="searchForm.genderRequirements">
                    <el-radio v-for="item in $dictUtils.getDictList('sex')" :label="item.value" :key="item.id">{{item.label}}</el-radio>
                  </el-radio-group>
         </el-form-item>
         <el-form-item prop="workingHours">
                <el-input size="small" v-model="searchForm.workingHours" placeholder="工作时段" clearable></el-input>
         </el-form-item>
         <el-form-item prop="employmentDate">
                <el-input size="small" v-model="searchForm.employmentDate" placeholder="用工日期" clearable></el-input>
         </el-form-item>
         <el-form-item prop="JobDescription">
                <el-input size="small" v-model="searchForm.JobDescription" placeholder="职位描述" clearable></el-input>
         </el-form-item>
         <el-form-item prop="reasonRejection">
                <el-input size="small" v-model="searchForm.reasonRejection" placeholder="拒绝原因" clearable></el-input>
         </el-form-item> -->
         <el-form-item prop="auditTime">
               <el-date-picker
                    v-model="searchForm.auditTime"
                    type="daterange"
                    size="small"
                    align="right"
                    value-format="yyyy-MM-dd hh:mm:ss"
                    unlink-panels
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期">
                 </el-date-picker>
         </el-form-item>
         <el-form-item prop="auditStatus">
            <el-select
            v-model="searchForm.auditStatus"
            placeholder="审核状态"
            size="small"
            style="width: 100%"
          >
            <el-option label="待审核" value="0">待审核</el-option>
            <el-option label="已审核" value="1">已审核</el-option>
            <el-option label="已拒绝" value="2">已拒绝</el-option>
          </el-select>
       </el-form-item>
         <!-- <el-form-item prop="shelfStatus">
                  <el-radio-group v-model="searchForm.shelfStatus">
                    <el-radio v-for="item in $dictUtils.getDictList('')" :label="item.value" :key="item.id">{{item.label}}</el-radio>
                  </el-radio-group>
         </el-form-item>
         <el-form-item prop="whetherRecommendedRecruitment">
                  <el-radio-group v-model="searchForm.whetherRecommendedRecruitment">
                    <el-radio v-for="item in $dictUtils.getDictList('')" :label="item.value" :key="item.id">{{item.label}}</el-radio>
                  </el-radio-group>
         </el-form-item>-->
         <el-form-item prop="whetherTopHome">
            <el-select
              v-model="searchForm.whetherTopHome"
              placeholder="大首页置顶状态"
              size="small"
              style="width: 100%"
            >
              <el-option label="未置顶" value="0">否</el-option>
              <el-option label="已置顶" value="1">是</el-option>
          </el-select>
         </el-form-item>
         <el-form-item prop="homeDisplay">
                <el-select
                v-model="searchForm.homeDisplay"
                placeholder="首页置顶状态"
                size="small"
                style="width: 100%"
              >
              <el-option label="未置顶" value="0">否</el-option>
              <el-option label="已置顶" value="1">是</el-option>
          </el-select>
         </el-form-item>
         <!-- <el-form-item prop="remarks">
                <el-input size="small" v-model="searchForm.remarks" placeholder="备注信息" clearable></el-input>
         </el-form-item> -->
          <el-form-item>
            <el-button type="primary" @click="refreshList()" size="small">查询</el-button>
            <el-button @click="resetSearch()" size="small">重置</el-button>
          </el-form-item>
      </el-form>
        <!-- 导入导出-->
      <el-form :inline="true" v-show="isImportCollapse"  class="query-form" ref="importForm">
         <el-form-item>
          <el-button type="default" @click="downloadTpl()" size="small">下载模板</el-button>
         </el-form-item>
         <el-form-item prop="loginName">
            <el-upload
              class="upload-demo"
              :action="`${this.$http.BASE_URL}/p_recruitmentinformation/pRecruitmentInformation/import`"
              :on-success="uploadSuccess"
               :show-file-list="true">
              <el-button size="small" type="primary">点击上传</el-button>
              <div slot="tip" class="el-upload__tip">只允许导入“xls”或“xlsx”格式文件！</div>
            </el-upload>
        </el-form-item>
      </el-form>
      <el-row>
        <el-button v-if="hasPermission('p_recruitmentinformation:pRecruitmentInformation:add')" type="primary" size="small" icon="el-icon-plus" @click="add()">新建</el-button>
        <el-button v-if="hasPermission('p_recruitmentinformation:pRecruitmentInformation:edit')" type="warning" size="small" icon="el-icon-edit-outline" @click="edit()"
         :disabled="dataListSelections.length != 1" plain>修改</el-button>
        <el-button v-if="hasPermission('p_recruitmentinformation:pRecruitmentInformation:del')" type="danger"   size="small" icon="el-icon-delete" @click="del()"
                  :disabled="dataListSelections.length <= 0" plain>删除
        </el-button>
        <el-button-group class="pull-right">
            <el-button
              type="default"
              size="small"
              icon="el-icon-search"
              @click="isSearchCollapse = !isSearchCollapse, isImportCollapse=false">
            </el-button>
            <el-button v-if="hasPermission('p_recruitmentinformation:pRecruitmentInformation:export')" type="default" size="small" icon="el-icon-download" title="导出" @click="exportExcel()"></el-button>
            <el-button
              type="default"
              size="small"
              icon="el-icon-refresh"
              @click="refreshList">
            </el-button>
        </el-button-group>
      </el-row>
    <el-table
      :data="dataList"
      border
      size="medium"
      @selection-change="selectionChangeHandle"
      @sort-change="sortChangeHandle"
      v-loading="loading"
      class="table">
      <el-table-column
        type="selection"
        header-align="center"
        align="center"
        width="50">
      </el-table-column>
      <el-table-column
        prop="publisher.phone"
        show-overflow-tooltip
        label="发布人手机号">
            <template slot-scope="scope">
              <el-link  type="primary" :underline="false" v-if="hasPermission('p_recruitmentinformation:pRecruitmentInformation:edit')" @click="edit(scope.row.id)">{{scope.row.publisher.phone}}</el-link>
              <el-link  type="primary" :underline="false" v-else-if="hasPermission('p_recruitmentinformation:pRecruitmentInformation:view')"  @click="view(scope.row.id)">{{scope.row.publisher.phone}}</el-link>
              <span v-else>{{scope.row.publisher.phone}}</span>
              <span v-if="!scope.row.publisher || scope.row.publisher.delFlags != 0" style="color: red;">(已注销)</span>
            </template>
      </el-table-column>
      <el-table-column
        prop="certification.enterpriseFullName"
        show-overflow-tooltip
        label="企业全称">
      </el-table-column>
    <!-- <el-table-column
        prop="bussinessType"
        show-overflow-tooltip
        label="业务类型">
        <template slot-scope="scope">
             {{ $dictUtils.getDictLabel("business_type", scope.row.bussinessType, '-') }}
        </template>
      </el-table-column> -->
    <el-table-column
        prop="recruitmentType"
        show-overflow-tooltip
        label="招聘类型">
        <template slot-scope="scope">
             {{ scope.row.recruitmentType == '1'?'全职':'兼职' }}
        </template>
      </el-table-column>
    <el-table-column
        prop="title"
        show-overflow-tooltip
        label="标题">
      </el-table-column>
    <el-table-column
        prop="positionCategory"
        show-overflow-tooltip
        label="职位名称">
      </el-table-column>
    <!-- <el-table-column
        prop="yearsService"
        show-overflow-tooltip
        label="工作年限">
      </el-table-column>
    <el-table-column
        prop="educationalRequirements"
        show-overflow-tooltip
        label="学历要求">
      </el-table-column> -->
    <el-table-column
        prop="salaryRange"
        show-overflow-tooltip
        label="薪资范围">
      </el-table-column>
    <!-- <el-table-column
        prop="fringeBenefits"
        show-overflow-tooltip
        label="福利待遇">
     </el-table-column> -->
    <!--  <el-table-column
        prop="companyProfile"
        show-overflow-tooltip
        label="公司简介">
      </el-table-column> -->
    <!-- <el-table-column
        prop="settlementMethod"
        show-overflow-tooltip
        label="结算方式">
      </el-table-column>
    <el-table-column
        prop="workCycle"
        show-overflow-tooltip
        label="工作周期">
      </el-table-column> -->
    <!-- <el-table-column
        prop="positionCategory"
        show-overflow-tooltip
        label="职位类别">
      </el-table-column> -->
    <!-- <el-table-column
        prop="region"
        show-overflow-tooltip
        label="所在区域">
      </el-table-column> -->
    <!-- <el-table-column
        prop="workLocation"
        show-overflow-tooltip
        label="工作地点">
      </el-table-column>
    <el-table-column
        prop="longitude"
        show-overflow-tooltip
        label="经度">
      </el-table-column>
    <el-table-column
        prop="latitude"
        show-overflow-tooltip
        label="纬度">
      </el-table-column> -->
    <el-table-column
        prop="contactNumber"
        show-overflow-tooltip
        label="联系电话">
      </el-table-column>
     <!--<el-table-column
        prop="recruitersNumber"
        show-overflow-tooltip
        label="招聘人数">
      </el-table-column> -->
    <!-- <el-table-column
        prop="genderRequirements"
        show-overflow-tooltip
        label="性别要求">
        <template slot-scope="scope">
             {{ $dictUtils.getDictLabel("sex", scope.row.genderRequirements, '-') }}
        </template>
      </el-table-column>
    <el-table-column
        prop="workingHours"
        show-overflow-tooltip
        label="工作时段">
      </el-table-column>
    <el-table-column
        prop="employmentDate"
        show-overflow-tooltip
        label="用工日期">
      </el-table-column> -->
    <!-- <el-table-column
        prop="jobDescription"
        show-overflow-tooltip
        label="职位描述">
      </el-table-column>
    <el-table-column
        prop="positionSort"
        show-overflow-tooltip
        label="位置排序">
      </el-table-column> -->
    <el-table-column
        prop="auditStatus"
        show-overflow-tooltip
        label="审核状态">
        <template slot-scope="scope">
          <el-tag type="danger" v-if="scope.row.auditStatus == 0"
            >未审核</el-tag
          >
          <el-tag type="success" v-if="scope.row.auditStatus == 1"
            >已审核</el-tag
          >
          <el-tag type="danger" v-if="scope.row.auditStatus == 2"
            >已拒绝</el-tag
          >
        </template>
      </el-table-column>
    <!-- <el-table-column
        prop="reasonRejection"
        show-overflow-tooltip
        label="拒绝原因">
      </el-table-column> -->

    <el-table-column
        prop="shelfStatus"
        show-overflow-tooltip
        label="上架状态">
        <template slot-scope="scope">
          <el-tag type="danger" v-if="scope.row.shelfStatus == 0">未上架</el-tag>
          <el-tag type="success" v-if="scope.row.shelfStatus == 1">已上架</el-tag>
        </template>
      </el-table-column>
      <el-table-column
      prop="whetherTopHome"
      show-overflow-tooltip
      label="大首页置顶状态">
      <template slot-scope="scope">
        <el-tag type="danger" v-if="scope.row.whetherTopHome == 0">未置顶</el-tag>
        <el-tag type="success" v-if="scope.row.whetherTopHome == 1">已置顶</el-tag>
      </template>
    </el-table-column>
    <el-table-column
    prop="homeDisplay"
    show-overflow-tooltip
    label="招才置顶状态">
    <template slot-scope="scope">
      <el-tag type="danger" v-if="scope.row.homeDisplay == 0">未置顶</el-tag>
      <el-tag type="success" v-if="scope.row.homeDisplay == 1">已置顶</el-tag>
    </template>
  </el-table-column>
    <!-- <el-table-column
        prop="whetherRecommendedRecruitment"
        show-overflow-tooltip
        label="是否为推荐招聘">
        <template slot-scope="scope">
             {{ $dictUtils.getDictLabel("", scope.row.whetherRecommendedRecruitment, '-') }}
        </template>
      </el-table-column> -->
    <!-- <el-table-column
        prop="whetherTopHome"
        show-overflow-tooltip
        label="是否置顶到大首页">
        <template slot-scope="scope">
             {{ $dictUtils.getDictLabel("", scope.row.whetherTopHome, '-') }}
        </template>
      </el-table-column>
    <el-table-column
        prop="homeDisplay"
        show-overflow-tooltip
        label="是否首页显示">
        <template slot-scope="scope">
             {{ $dictUtils.getDictLabel("", scope.row.homeDisplay, '-') }}
        </template>
      </el-table-column> -->
    <!-- <el-table-column
        prop="topSettingDays"
        show-overflow-tooltip
        label="首页置顶天数">
      </el-table-column>
    <el-table-column
        prop="topSettingTimes"
        show-overflow-tooltip
        label="首页置顶时间">
      </el-table-column> -->
    <el-table-column
        prop="createDate"
        show-overflow-tooltip
        sortable="custom"
        label="创建时间">
      </el-table-column>
      <el-table-column
        prop="auditName"
        show-overflow-tooltip
        label="审核人员"
      >
      </el-table-column>
    <el-table-column
        prop="auditTime"
        show-overflow-tooltip
        sortable="custom"
        label="审核时间">
      </el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        fixed="right"
        width="200"
        label="操作">
        <template  slot-scope="scope">
          <el-button v-if="hasPermission('p_recruitmentinformation:pRecruitmentInformation:view')" type="text" icon="el-icon-view" size="small" @click="view(scope.row.id)">查看</el-button>
          <el-button v-if="hasPermission('p_recruitmentinformation:pRecruitmentInformation:edit')" type="text" icon="el-icon-edit" size="small" @click="edit(scope.row.id)">修改</el-button>
          <el-button v-if="hasPermission('p_recruitmentinformation:pRecruitmentInformation:del')" type="text"  icon="el-icon-delete" size="small" @click="del(scope.row.id)">删除</el-button>
          <el-button v-if="hasPermission('p_recruitmentinformation:pRecruitmentInformation:audit') && scope.row.auditStatus == 0" type="text" icon="el-icon-edit" size="small" @click="audit(scope.row.id, 1)">通过</el-button>
          <el-button v-if="hasPermission('p_recruitmentinformation:pRecruitmentInformation:audit') && scope.row.auditStatus == 0" type="text" icon="el-icon-edit" size="small" @click="refuse(scope.row.id, 2)">拒绝</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pageNo"
      :page-sizes="[10, 20, 50, 100]"
      :page-size="pageSize"
      :total="total"
      background
      layout="total, sizes, prev, pager, next, jumper">
    </el-pagination>
        <!-- 弹窗, 新增 / 修改 -->
    <PRecruitmentInformationForm  ref="pRecruitmentInformationForm" @refreshDataList="refreshList"></PRecruitmentInformationForm>
  </div>
</template>

<script>
  import PRecruitmentInformationForm from './PRecruitmentInformationForm'
  import GridSelect from '@/components/gridSelect'
  export default {
    data () {
      return {
        searchForm: {
          publisher: {
            id: ''
          },
          certification: {
            id: ''
          },
          bussinessType: '',
          recruitmentType: '',
          title: '',
          positionName: '',
          yearsService: '',
          educationalRequirements: '',
          salaryRange: '',
          fringeBenefits: '',
          companyProfile: '',
          settlementMethod: '',
          workCycle: '',
          positionCategory: '',
          region: '',
          workLocation: '',
          contactNumber: '',
          recruitersNumber: '',
          genderRequirements: '',
          workingHours: '',
          employmentDate: '',
          JobDescription: '',
          reasonRejection: '',
          auditStatus:'',
          auditTime: '',
          shelfStatus: '',
          whetherRecommendedRecruitment: '',
          whetherTopHome: '',
          homeDisplay: '',
          remarks: ''
        },
        dataList: [],
        pageNo: 1,
        pageSize: 10,
        total: 0,
        orderBy: '',
        dataListSelections: [],
        isSearchCollapse: false,
        isImportCollapse: false,
        loading: false
      }
    },
    components: {
      GridSelect,
      PRecruitmentInformationForm
    },
    activated () {
      this.searchForm.auditStatus = this.$route.query.auditStatus;
      this.refreshList()
    },

    methods: {
      // 获取数据列表
      refreshList () {
        this.loading = true
        this.$http({
          url: '/p_recruitmentinformation/pRecruitmentInformation/list',
          method: 'get',
          params: {
            'pageNo': this.pageNo,
            'pageSize': this.pageSize,
            'orderBy': this.orderBy,
            beginAuditTime: this.searchForm.auditTime[0],
            endAuditTime: this.searchForm.auditTime[1],
            ...this.lodash.omit(this.searchForm, 'auditTime')
          }
        }).then(({data}) => {
          if (data && data.success) {
            this.dataList = data.page.list
            this.total = data.page.count
            this.loading = false
          }
        })
      },
      // 每页数
      sizeChangeHandle (val) {
        this.pageSize = val
        this.pageNo = 1
        this.refreshList()
      },
      // 当前页
      currentChangeHandle (val) {
        this.pageNo = val
        this.refreshList()
      },
      // 多选
      selectionChangeHandle (val) {
        this.dataListSelections = val
      },

    // 排序
      sortChangeHandle (obj) {
        if (obj.order === 'ascending') {
          this.orderBy = obj.prop + ' asc'
        } else if (obj.order === 'descending') {
          this.orderBy = obj.prop + ' desc'
        } else {
          this.orderBy = ''
        }
        this.refreshList()
      },
      // 新增
      add () {
        this.$refs.pRecruitmentInformationForm.init('add', '')
      },
      // 修改
      edit (id) {
        id = id || this.dataListSelections.map(item => {
          return item.id
        })[0]
        this.$refs.pRecruitmentInformationForm.init('edit', id)
      },
      // 查看
      view (id) {
        this.$refs.pRecruitmentInformationForm.init('view', id)
      },
      // 删除
      del (id) {
        let ids = id || this.dataListSelections.map(item => {
          return item.id
        }).join(',')
        this.$confirm(`确定删除所选项吗?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.loading = true
          this.$http({
            url: '/p_recruitmentinformation/pRecruitmentInformation/delete',
            method: 'delete',
            params: {'ids': ids}
          }).then(({data}) => {
            if (data && data.success) {
              this.$message.success(data.msg)
              this.refreshList()
            }
            this.loading = false
          })
        })
      },
      // 导入成功
      uploadSuccess (res, file) {
        if (res.success) {
          this.$message.success({dangerouslyUseHTMLString: true,
            message: res.msg})
        } else {
          this.$message.error(res.msg)
        }
      },
      // 下载模板
      downloadTpl () {
        this.$utils.download('/p_recruitmentinformation/pRecruitmentInformation/import/template')
      },
      exportExcel () {
        this.$utils.download('/p_recruitmentinformation/pRecruitmentInformation/export')
      },
      resetSearch () {
        this.$refs.searchForm.resetFields()
        this.refreshList()
      },
      audit(id, status) {
        this.$confirm(`确定当前操作?`, "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }).then(() => {
          this.loading = true;
          this.$http({
            url: "/p_recruitmentinformation/pRecruitmentInformation/audit",
            method: "post",
            params: { id: id, auditStatus: status },
          }).then(({ data }) => {
            if (data && data.success) {
              this.$message.success(data.msg);
              this.refreshList();
            }
            if (!data.success) {
              this.refreshList();
            }
            this.loading = false;
          });
        });
      },
      //拒绝审核
      refuse(id, status) {
        this.$prompt("请输入拒绝原因", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
        })
          .then(({ value }) => {
            if (!value){
              this.$message.error("请输入拒绝原因");
              return false
            }
            this.loading = true;
            this.$http({
              url: "/p_recruitmentinformation/pRecruitmentInformation/audit",
              method: "post",
              params: { id: id, auditStatus: status, refuseReason: value },
            }).then(({ data }) => {
              if (data && data.success) {
                this.$message.success(data.msg);
                this.refreshList();
              }
              if (!data.success) {
                this.refreshList();
              }
              this.loading = false;
            });
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "取消输入",
            });
          });
      },
    }
  }
</script>
